package com.xxx.mall.adapter;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @author 邢晨旭
 * {@code @date} 2023/11/16
 */
@Component
public class DefaultAuthConfigAdapter implements AuthConfigAdapter {

    /**
     * 外部直接调用接口，无需登录权限 unwanted auth
     */
    private static final String EXTERNAL_URI = "/**/ua/**";

    @Override
    public List<String> pathPatterns() {
        return Collections.singletonList("/*");
    }

    @Override
    public List<String> excludePathPatterns(String... paths) {
        List<String> excludePaths = new ArrayList<>();
        excludePaths.add(EXTERNAL_URI);
        excludePaths.addAll(Arrays.asList(paths));
        return excludePaths;
    }
}
